package com.wnhz.trim.construction.service.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.wnhz.trim.construction.service.dao.BuildDao;
import com.wnhz.trim.construction.service.service.BuildService;
import com.wnhz.trim.domain.entity.Build;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
@Slf4j
public class BuildServiceImpl implements BuildService {

    @Autowired
    private BuildDao buildDao;




    @Override
    public void add(Build build) {
        buildDao.insert(build);


    }

    @Override
    public void delete(int id) {
        buildDao.deleteById(id);

    }

    @Override
    public void update(Build build) {
        buildDao.updateById(build);

    }

    @Override
    public List<Build> findByNameLike(String name) {
        LambdaQueryWrapper<Build> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.like(Build::getOwnerName,name);
        return buildDao.selectList(queryWrapper);     //更具名字模糊查询
    }

    @Override
    public List<Build> findAll() {
        return buildDao.selectList(null);
    }
}
